import {
    elFormItem,
    elFormplaceholder,
    AttrType,
    ComponentType,
    DragFormType,
    componentList,
    JSONType,
    compontent,
    hiddenAttrs,
    elFormClearable,//隐藏属性 每个组件偶必须有如果引入elFormItem 就不需要了
  } from "element-easy-form";
const attrsJson: DragFormType[] = [
    ...elFormItem(),
    elFormClearable(),
    elFormplaceholder("请选择"),
  {
    
    label: "渲染类型",
    prop: "dataType",
    type: AttrType.COMPONENT,
    defaultValue: "select",
    componentName: ComponentType.ElSelect,
    attrs: {
      placeholder: "请选择类型",
      clearable: true,
    },
    rules: [],
    children:[
        {
            componentName: ComponentType.ElOption,
            label: "选择按钮",
            value: "radioButton",
          },
          {
            componentName: ComponentType.ElOption,
            label: "下拉框",
            value: "select",
          },
    ]
  },
  {
    type: AttrType.COMPONENT,
    label: "默认值",
    prop: "defaultValue",

    defaultValue: "",
    componentName: ComponentType.ElInput,
    attrs: {
      placeholder: "请输入",
    },
    rules: [{ required: false, message: "", trigger: "change" }],
  },
  {
    type: AttrType.COMPONENT,
    label: "字典编码",
    prop: "dictCode",

    defaultValue: "",
    componentName: ComponentType.ElInput,
    attrs: {
      placeholder: "请输入",
    },
    rules: [],
  },
     {
      type: AttrType.COMPONENT,
      label: "是否筛选",
      prop: "filterable",
      
      defaultValue: true,
      componentName:  ComponentType.ElSwitch,
      attrs: {
      },
    },
];

export const events: DragFormType[] = [
      {
        type: AttrType.COMPONENT,
        label: "change选中值发生变化时触发",
        prop: "change",
        defaultValue: `function change(config,data,value){
            }`
           ,
        componentName:  ComponentType.ElFunctionEvent,
        attrs: {
          title:"选中值发生变化时触发"
        },
      },
]
export const selectDict: DragFormType=   {
    title: "选择器",
    prop: "",
    label: "选择器", formType:JSONType.ALL,
    type: AttrType.COMPONENT,
    attrs: {
      placeholder: "请选择",
      // disabled:true
    },
    formItemAttrs: {},
    rules: [],
    events:events,
    attrsJson:attrsJson,
    componentName: 'selectDict', // 组件名称，用于生成代码
    children: [
    ]
  }
  